<template>
  <el-table
    :data="orderData"
    stripe
    class="table">
    <el-table-column
      prop="bno"
      label="订单号"
      >
    </el-table-column>
    <el-table-column
      prop="cno"
      label="客户编号"
      >
    </el-table-column>
    <el-table-column
      prop="vno"
      label="经手车辆">
    </el-table-column>
    <el-table-column
      prop="price"
      label="订单总价">
    </el-table-column>
    <el-table-column
      prop="deal_date"
      label="成交日期">
    </el-table-column>
    <el-table-column
      prop="carry_date"
      label="交付日期">
    </el-table-column>
    <el-table-column
      prop="way"
      label="车辆来源">
    </el-table-column>
    <el-table-column
      prop="accomplish"
      label="交付状态">
    </el-table-column>
    <el-table-column
      prop="remain"
      label="尾款">
    </el-table-column>
    <el-table-column>
      <template slot-scope="scope">
        <el-button v-if="scope.row.accomplish==='已完成'" disabled>已完成</el-button>
        <el-button @click="deliver(scope.row)" v-if="scope.row.accomplish==='未付款'">付 款</el-button>
        <el-button type="primary" @click="deliver(scope.row)" v-if="scope.row.accomplish==='已付款'">提 车</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  export default {
    name: "OrderTable",
    props:{
      orderData:[],
    },
    data(){
      return{
      }
    },
    mounted() {
    },
    methods:{
      deliver(param){
        this.$confirm('确认进行操作？', '提示',{
          confirmButtonText:'确定',
          cancelButtonText:'取消',
          type:'warning'
        }).then(() => {
          let mydata={
            bno:param.bno,
          };
          console.log(mydata);
          this.$axios.post('/modify_border',mydata).then((res) => {
            if(res.data==='1'){
              this.$emit("modifyed");
              this.$message({
                type: 'success',
                message: '操作成功!'
              });
            }else {
              this.$message({
                type: 'error',
                message: '操作失败!'
              });
            }
            this.$emit("delivered");
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消操作'
          });
        });
      },
    }
  }
</script>

<style scoped>
  .table{
    height: 725px;
    width: 100%;
    overflow-y: scroll;
  }
</style>
